package top.ffhome.concurrent.beautiful.ch01;

import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;

public class WaitNotifyInterrupt {
    private static final Log log = LogFactory.get();

    private static volatile Object obj = new Object();

    public static void main(String[] args) throws InterruptedException {
        Thread threadA = new Thread(() -> {
            try {
                log.info("---begin---");
                synchronized (obj) {
                    obj.wait();
                }
                log.info("---end---");
            } catch (InterruptedException e) {
                log.error(e);
            }
        });

        threadA.start();
        Thread.sleep(1000);
        log.info("---begin interrupt threadA---");
        threadA.interrupt();
        log.info("---end interrupt threadA---");
    }
}
